package com.multitrack.googlemap;

//import android.app.ActivityManager;
import java.util.ArrayList;
import java.util.Iterator;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.Projection;

public class GMapDrawPoint extends Overlay {
	private ArrayList<GeoPoint> drawPoint; // Contains set of points to be
											// connected.
	private Paint pathPaint = null;
	private Point point = null;

	public GMapDrawPoint(ArrayList<GeoPoint> arrayGeoPoint) {
		super();

		this.drawPoint = arrayGeoPoint;
		this.pathPaint = new Paint();
		this.pathPaint.setAntiAlias(true);
	}

	@Override
	public void draw(Canvas canvas, MapView mView, boolean shadow) {
		super.draw(canvas, mView, shadow);

		Projection projection = mView.getProjection();

		// draw Point
		setPathPaint();

		Iterator<GeoPoint> it = drawPoint.iterator();

		while (it.hasNext()) {

			point = projection.toPixels(it.next(), null);
			canvas.drawPoint(point.x, point.y, pathPaint);

		}

	}

	public void setPathPaint() {

		this.pathPaint.setStrokeWidth(6);
		this.pathPaint.setARGB(255, 255, 0, 0);
		this.pathPaint.setStyle(Paint.Style.STROKE);
	}

}
